package cn.felord.spring.security.controller;

import com.sun.deploy.net.HttpResponse;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author tianyingke
 * @desc
 * @date 2021-07-14 11:10:20
 */
@RestController
@RequestMapping("/login")
public class Login {

    @PostMapping
    public void login(String passWord, String username, HttpServletRequest request , HttpServletResponse response) throws IOException {
        passWord=  request.getParameter("password");
        username=request.getParameter("username");
        if(passWord.equals("123456")&username.equals("admin")){
            response.sendRedirect("/echarts/echarts.html");
        }else {
            response.sendRedirect("/404/404.html");
        }
    }
}
